const OSS = require('ali-oss')
// const fs = require('fs')

export function getClient() {
  const client = new OSS({
    region: 'oss-cn-shenzhen',
    accessKeyId: 'LTAI4G3KJMauxFqaimcB1mdC',
    accessKeySecret: '7xxPDPH8j3ypwKMaUEGNRKe5hu2KQ5',
    bucket: 'bookstore-img'
  })
  return client
}

export const getFileNameUUID = () => {
  function rx() {
    return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1)
  }
  return `${+new Date()}_${rx()}${rx()}`
}

